package com.gxp.service.impl;

import java.util.List;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.gxp.mapper.GameGoodsMapper;
import com.gxp.mapper.GameMapper;
import com.gxp.mapper.GameServerMapper;
import com.gxp.mapper.GameTypeMapper;
import com.gxp.pojo.Game;
import com.gxp.pojo.GameGoods;
import com.gxp.pojo.GameServer;
import com.gxp.pojo.GameType;
import com.gxp.service.GameService;

@Service
@Transactional
public class GameServiceImpl implements GameService {

	@Autowired
	private GameTypeMapper gameTypeMapper;
	
	@Autowired
	private GameMapper gameMapper;
	
	@Autowired
	private GameServerMapper gameServerMapper;
	
	@Autowired
	private GameGoodsMapper gameGoodsMapper;
	
	@Override
	public List<GameType> getGameTypes() {
		return gameTypeMapper.findAllTypes();
	}

	@Override
	public void saveGame(Game game) {
		gameMapper.save(game);
	}

	@Override
	public List<Game> getGames() {
		return gameMapper.getGames();
	}

	@Override
	public List<GameServer> getGameServers(int gameId) {
		return gameServerMapper.getGameServers(gameId);
	}

	@Override
	public void saveGameServer(GameServer server) {
		gameServerMapper.saveGameServer(server);
	}

	@Override
	public void updateServerStatus(Map<String, Object> param) {
		gameServerMapper.updateServerStatus(param);
	}

	@Override
	public Game getGame(int gameId) {
		return gameMapper.getGame(gameId);
	}

	@Override
	public void updateGame(Game gameInput) {
		gameMapper.updateGame(gameInput);
	}

	@Override
	public void updateGameStatus(Map<String, Object> param) {
		gameMapper.updateGameStatus(param);
	}

	@Override
	public List<GameGoods> getEquipments(Integer gameId) {
		return gameGoodsMapper.getEquipments(gameId);
	}

	@Override
	public void saveEquipment(GameGoods goods) {
		gameGoodsMapper.saveEquipment(goods);
	}

	@Override
	public void updateEquipStatus(Map<String, Object> param) {
		gameGoodsMapper.updateGoodsStatus(param);
	}

	@Override
	public void updateEquip(GameGoods goods) {
		gameGoodsMapper.updateGoods(goods);
	}

	@Override
	public void updateServer(GameServer gameServer) {
		gameServerMapper.updateGameServer(gameServer);
	}

}
